package com.ghpt.controller;
import com.ghpt.pojo.BeiYaShi;
import com.ghpt.service.BeiYaShiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/beiya")
public class BeiYaShiController {
    private final BeiYaShiService beiYaShiService;

    public BeiYaShiController(BeiYaShiService beiYaShiService) {
        this.beiYaShiService = beiYaShiService;
    }
    @GetMapping("/{id}")
    public BeiYaShi getBeiYaShiById(@PathVariable Long id) {
        System.out.println("结果是"+beiYaShiService.findBeiYaShiById(id));
        return beiYaShiService.findBeiYaShiById(id);
    }
    @PutMapping
    public int updateBeiYaShi(@RequestBody BeiYaShi beiYaShi) {
        return beiYaShiService.updateById(beiYaShi);
    }
}
